package org.point.dao.impl;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.point.common.dao.impl.BaseDaoImpl;
import org.point.dao.ConvertOrderStatusDao;
import org.point.dao.ConvertRuleDetailDao;
import org.point.dao.ConvertRuleDetailDao;
import org.point.dao.ConvertRuleDetailDao;
import org.point.domain.ConvertOrderStatus;
import org.point.domain.ConvertRuleDetail;
import org.springframework.stereotype.Repository;

/**
 * 
 * @ClassName: ConvertRuleDetailDaoImpl  
 * @Description: TODO(兑换规则明细数据实现类)  
 * @author Kenny_Z' szqiuk@gmail.com
 * @date 2016年10月23日 下午3:28:17  
 *
 */
@Repository("convertOrderStatusDao")
public class ConvertOrderStatusDaoImpl extends BaseDaoImpl<ConvertOrderStatus, Serializable> implements ConvertOrderStatusDao {

	private static final String SQLID_INSERTCOS = "insert_cos";
	
	private static final String SQLID_VERIFYORDERS = "verifyOrders";

	private static final String SQLID_CANCELORDER = "cancel_order";

	/**
	 * 利用反射，获取mapper.xml的namespace
	 * <p>Title: </p>  
	 * <p>Description: </p>
	 */
	public ConvertOrderStatusDaoImpl() {
		namespace = super.getNamespace();
	}

	public Integer insertCOS(ConvertOrderStatus record) {
		Integer result = 0;
		try {
			result = getSqlSession().insert(namespace + SQLID_INSERTCOS, record);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}
	
	public Integer verifyOrder(Map<String, Object> map) {
		Integer result = 0;
		try {
			result = getSqlSession().update(namespace + SQLID_VERIFYORDERS, map);
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException("兑换订单删除错误！", e);
		}
		return result;
	}

	public Integer cancelOrder(Map<String, Object> map) {
		Integer result = 0;
		try {
			result = getSqlSession().update(namespace + SQLID_CANCELORDER, map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}


}
